package com.tsd.core.config;

import org.mybatis.spring.mapper.MapperScannerConfigurer;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description: Mapper接口的扫描类
 * @Author Luoyc
 * @Date 2019/2/18 10:05
 * @Modefied By:
 */
@Configuration
//保证在MyBatisConfig实例化之后再实例化该类
@AutoConfigureAfter(MyBatisConfig.class)
public class MapperScannerConfig {

    // mapper接口的扫描器
    @Bean
    public static MapperScannerConfigurer mapperScannerConfigurer() {
        MapperScannerConfigurer configurer = new MapperScannerConfigurer();
        configurer.setSqlSessionFactoryBeanName("sqlSessionFactoryBean");
        configurer.setBasePackage("com.tsd.**.dao");
        return configurer;
    }
}
